package work.com;

import java.util.Scanner;

public class Exam03 {
    //去除重复字符
    public static String quChong(String str){
        str = str.replace("  ","");
        String newstr ="";
        for (int i = 0; i < str.length(); i++) {
           char ch = str.charAt(i);
           if (str.indexOf(ch) == i){
               newstr = newstr.concat(String.valueOf(ch));
           }
        }
        return newstr;
    }

    public static String quChong1(String str){
        str = str.replace("  ","");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i <str.length() ; i++) {
            if (str.indexOf(str.charAt(i)) == i){
                sb.append(str.charAt(i));
            }
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String str = sc.next();
        System.out.println(quChong1(str));
    }
}
